327B - Hungry Sequence - CodeForces Solution


math *1200

Please click on ads to support us..

Python Code:

n = int(input())
for x in range(n) : print(n+x,end = ' ')

C++ Code:

// Bismillahir Rahmanir Rahim
// SHAHRIAR MAHMUD ARMAN
// AUTHOR : iamarman252575
#include<bits/stdc++.h>
#include<ctime>
#include<string>
# define ll long long
# define test int test; cin>>test; while(test--)
# define rep(i,a,b) for(int i=a;i<b;i++)
#define rep_n(i,a,b) for(int i=a;i<=b;i++)
#define rep_rev(i,a,b) for(int i=b;a>=1;i--)
#define pb push_back
#define el endl
#define optimise()  { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin.clear(); }
#define R0 return 0
#define sz(x) x.size()
#define all(v) v.begin(),v.end()
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define sp " "
#define vii vector<int>
#define vll vector<long long>
#define yess cout<<"YES"<<el
#define noo cout<<"NO"<<el
#define PI 2*acos(0.0)
using namespace std;
inline void file() {

#ifndef ONLINE_JUDGE

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

#endif // ONLINE_JUDGE
}

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

set<ll> se;
vector<ll> ve;
vector<bool> vec(10000000,1);
void seive()
{
    ll n=10000000;
    vec[0]=0;
    vec[1]=0;
    for(ll i=2;i*i<=n;i++)
    {
        if(vec[i]==1)
        {   
            for(ll j=i*i;j<=n;j=j+i)
            {
                vec[j]=0;
            }
        }
    }
for(int i=2;i<=n;i++)
if(vec[i]) ve.pb(i);
}
void solve()
{ 
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
      cout<<ve[i]<<el;
    }
} 
int main()

{
    optimise();
    seive();
    file();
    solve();





}


Comments

Submit
0 Comments
More Questions

454B - Little Pony and Sort by Shift
1152A - Neko Finds Grapes
1719B - Mathematical Circus
1719C - Fighting Tournament
1642A - Hard Way
285C - Building Permutation
1719E - Fibonacci Strings
1696C - Fishingprince Plays With Array
1085A - Right-Left Cipher
1508B - Almost Sorted
1690C - Restoring the Duration of Tasks
1055A - Metro
1036D - Vasya and Arrays
1139C - Edgy Trees
37A - Towers
353A - Domino
409H - A + B Strikes Back
1262A - Math Problem
158C - Cd and pwd commands
194A - Exams
1673B - A Perfectly Balanced String
1104B - Game with string
1169B - Pairs
1567D - Expression Evaluation Error
78A - Haiku
1287A - Angry Students
1428A - Box is Pull
234B - Reading
581B - Luxurious Houses
1481C - Fence Painting